function sayNameForAll () {
  // console.log('this的指向是===========')
  console.log(this)
  console.log(this.name)
}
var person1 =  {
  name:"Nicholas",
  sayName: sayNameForAll
}
var person2 = {
  name:"Greg",
  sayName: sayNameForAll
}
var person3 = {
  name:"kelelle",
  sayName: sayNameForAll
}

// person1.sayName()
let test1 = person1.sayName.bind(person2.name);
test1()
// test1.bind(person3)()
// person1.sayName.bind(person2).bind(person3)()


//bind 关于构造函数
// function Person (name,age) {
//   this.name = name;
//   this.age = age
// }
// Person.prototype.sayName = sayNameForAll;
// let alen = new Person('alen',12);
// console.log(alen.sayName())
// console.log(alen.sayName.bind(person3)) //bind 无法绑定到构造函数
// setTimeout(function(){
//   console.log(this)
//   console.log(arguments)
// }.bind('sss'), 1000);